/*
 * TiffCompressionNone
 * 
 * Copyright (c) 2002, 2003 Marco Schmidt.
 * All rights reserved.
 * 
 * translated to C# by asida
 * Copyright (c), Adam Sida, asida@centrum.cz
 */
using System;

namespace Petra.Gis.Geometry.Image.Tiff
{

  ///<summary>
  ///TIFF decoder for uncompressed bands
  ///</summary>>
  public class TiffCompressionNone : TiffCompression
  {


    public TiffCompressionNone()
      : base() { }



    public TiffCompressionNone(BlockBitmapFrame currImage)
      : base(currImage){ }



    //public override TiffCompression CreateCompression(BlockBitmapFrame currImage)
    //{
    //  return new TiffCompressionNone(currImage);
    
    //}



    public override byte[] DecompressBlock(BitmapBlock block, byte[] comprData, int srcBitsPerSample)
    {

      if (_image == null)
        throw new InvalidOperationException("no image presents to decompress");

      if (BitmapBlock.GetStrideLenght(block.Bounds.Width, srcBitsPerSample) != (block.Bounds.Width * srcBitsPerSample))
        return alignDataToStride(block.Bounds, comprData, srcBitsPerSample);
      else
        return comprData;
    }



    public override CompressionType[] CompressionTypes
    {
      get { return new CompressionType[] { CompressionType.NONE }; }
    }
  }
}
